//
//  BShopNoIncomeMenuView.m
//  DistributorAB
//
//  Created by LZY on 2019/9/30.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "BShopNoIncomeMenuView.h"

@interface BShopNoIncomeMenuView ()
@property (nonatomic, strong) UIImageView *ivNotice;//提示图片
@property (nonatomic, strong) UILabel *lblNoticeTitle;//提示标题
@property (nonatomic, strong) UILabel *lblNoticeContent;//提示内容
@end

@implementation BShopNoIncomeMenuView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
    }
    return self;
}
#pragma mark - 界面布局
- (void)setupView{
    [self addSubview:self.ivNotice];
    [self addSubview:self.lblNoticeTitle];
    [self addSubview:self.lblNoticeContent];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClickAction:)];
    [self addGestureRecognizer:tap];
}
#pragma mark - 交互事件
- (void)tapClickAction:(UITapGestureRecognizer *)tap{
    if (self.delegate && [self.delegate respondsToSelector:@selector(shopNoIncomeMenuViewClick:)]) {
        [self.delegate shopNoIncomeMenuViewClick:self.viewType];
    }
}
#pragma mark - 界面更新
- (void)setViewType:(BShopNoIncomeMenuViewType)viewType{
    _viewType = viewType;
    NSString *imageStr = @"";
    NSString *titleStr = @"";
    NSString *contentStr = @"";
    if (viewType == BShopNoIncomeMenuViewTypeGoods) {
        //产品管理
        imageStr = @"shop_no_income_goods";
        titleStr = @"产品管理";
        contentStr = @"产品信息内容";
    }else if (viewType == BShopNoIncomeMenuViewTypeOrder){
        //订单管理
        imageStr = @"shop_no_income_order";
        titleStr = @"订单管理";
        contentStr = @"实时查看不漏单";
    }else if (viewType == BShopNoIncomeMenuViewTypeMoney){
        //资金管理
        imageStr = @"shop_no_income_money";
        titleStr = @"资金管理";
        contentStr = @"查看收益金额";
    }else if (viewType == BShopNoIncomeMenuViewTypeShop){
        //店铺信息
        imageStr = @"shop_no_income_shop";
        titleStr = @"店铺信息";
        contentStr = @"店铺信息设置";
    }
    self.ivNotice.image = imgname(imageStr);
    self.lblNoticeTitle.text = titleStr;
    self.lblNoticeContent.text = contentStr;
}
#pragma mark - 懒加载
- (UIImageView *)ivNotice{
    if (!_ivNotice) {
        _ivNotice = [[UIImageView alloc] initWithFrame:CGRectMake((self.width - 30) / 2.0, 42, 30, 30)];
    }
    return _ivNotice;
}
- (UILabel *)lblNoticeTitle{
    if (!_lblNoticeTitle) {
        _lblNoticeTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 83, self.width, 24)];
        _lblNoticeTitle.text = @"";
        _lblNoticeTitle.font = [UIFont systemFontOfSize:17];
        _lblNoticeTitle.textColor = kColorWithHex(0x333333);
        _lblNoticeTitle.textAlignment = NSTextAlignmentCenter;
    }
    return _lblNoticeTitle;
}
- (UILabel *)lblNoticeContent{
    if (!_lblNoticeContent) {
        _lblNoticeContent = [[UILabel alloc] initWithFrame:CGRectMake(0, 107, self.width, 18)];
        _lblNoticeContent.text = @"";
        _lblNoticeContent.font = [UIFont systemFontOfSize:13];
        _lblNoticeContent.textColor = kColorWithHex(0x999999);
        _lblNoticeContent.textAlignment = NSTextAlignmentCenter;
    }
    return _lblNoticeContent;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
